package com.draw.platte;

import java.util.ArrayList;


public class ActionStack {
	private ArrayList<Action> mActionList = null;// save all the action the draw method does
	int mActionIndex;
	
	public ActionStack(){
		mActionList = new ArrayList<Action>();
		mActionIndex = -1;
	}
	
	public void addAction(Action pAction){
		mActionList.add(pAction);
		mActionIndex++;
	}
	
	public Action getAction(int iActionIndex){
		return mActionList.get(iActionIndex);
	}
	
	public int getEffectiveIndex(){
		return mActionIndex;
	}
	
	public void clearSpareAction(){//use this function when the new action has been done
		for (int i = mActionList.size()-1; i > mActionIndex; i--) {
			mActionList.remove(i);
		}
	}
	
	public void clearAllAction(){
		mActionList.clear();
	}
}
